package com.ruoyi.peach.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.peach.mapper.ConversationsMapper;
import com.ruoyi.peach.domain.Conversations;
import com.ruoyi.peach.service.IConversationsService;

/**
 * 会话Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-24
 */
@Service
public class ConversationsServiceImpl implements IConversationsService 
{
    @Autowired
    private ConversationsMapper conversationsMapper;

    /**
     * 查询会话
     * 
     * @param conversationId 会话主键
     * @return 会话
     */
    @Override
    public Conversations selectConversationsByConversationId(Long conversationId)
    {
        return conversationsMapper.selectConversationsByConversationId(conversationId);
    }

    /**
     * 查询会话列表
     * 
     * @param conversations 会话
     * @return 会话
     */
    @Override
    public List<Conversations> selectConversationsList(Conversations conversations)
    {
        return conversationsMapper.selectConversationsList(conversations);
    }

    /**
     * 新增会话
     * 
     * @param conversations 会话
     * @return 结果
     */
    @Override
    public Conversations insertConversations(Conversations conversations)
    {
        int result = conversationsMapper.insertConversations(conversations);
        if(result == 1 )
        {
            return conversations;
        }
        else
        {
            throw new RuntimeException("新增会话失败");
        }
    }

    /**
     * 修改会话
     * 
     * @param conversations 会话
     * @return 结果
     */
    @Override
    public int updateConversations(Conversations conversations)
    {
        return conversationsMapper.updateConversations(conversations);
    }

    /**
     * 批量删除会话
     * 
     * @param conversationIds 需要删除的会话主键
     * @return 结果
     */
    @Override
    public int deleteConversationsByConversationIds(Long[] conversationIds)
    {
        return conversationsMapper.deleteConversationsByConversationIds(conversationIds);
    }

    /**
     * 删除会话信息
     * 
     * @param conversationId 会话主键
     * @return 结果
     */
    @Override
    public int deleteConversationsByConversationId(Long conversationId)
    {
        return conversationsMapper.deleteConversationsByConversationId(conversationId);
    }
}
